<?php

namespace Sffi\ElementPlus\ElSearch;

use Sffi\ElementPlus\base\EntityToArray;

class Item
{
    use EntityToArray;
    protected string $key;
    protected string $type;
    protected string $dataKey;
    protected string $title;
    protected int $width;
    protected $default;

    /**
     * @param string $key
     * @param string $dataKey
     * @param string $title
     * @param int $width
     */
    public function __construct(string $title, string $key, string $dataKey, int $width = 120)
    {
        $this->key = $key;
        $this->dataKey = $dataKey;
        $this->title = $title;
        $this->width = $width;
    }


    /**
     * @return string
     */
    public function getKey(): string
    {
        return $this->key;
    }

    /**
     * @param string $key
     */
    public function setKey(string $key): void
    {
        $this->key = $key;
    }

    /**
     * @return string
     */
    public function getDataKey(): string
    {
        return $this->dataKey;
    }

    /**
     * @param string $dataKey
     */
    public function setDataKey(string $dataKey): void
    {
        $this->dataKey = $dataKey;
    }

    /**
     * @return string
     */
    public function getTitle(): string
    {
        return $this->title;
    }

    /**
     * @param string $title
     */
    public function setTitle(string $title): void
    {
        $this->title = $title;
    }

    /**
     * @return int
     */
    public function getWidth(): int
    {
        return $this->width;
    }

    /**
     * @param int $width
     */
    public function setWidth(int $width): void
    {
        $this->width = $width;
    }

    /**
     * @return mixed
     */
    public function getDefault()
    {
        return $this->default;
    }

    /**
     * @param mixed $default
     */
    public function setDefault($default): self
    {
        $this->default = $default;
        return $this;
    }
}